package cn.hsa.fqz.common.utils;

import cn.hsa.hsaf.core.framework.util.PageResult;
import com.github.pagehelper.PageInfo;

import java.util.List;

public class IPageHelper {

  public static <T, R> PageResult<T> toPage(PageInfo<R> page, Class<T> clazz) {
    PageResult<T> result = EntityCopyUtil.copy(page, PageResult.class);
    List<T> rows = EntityCopyUtil.copyList(page.getList(), clazz);
    result.setData(rows);
    return result;
  }

}
